package com.example.threadTest01;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * description: ThreadPoolTest <br>
 * date: 2020/7/31 11:05 <br>
 *
 * @author: ZhangYixin <br>
 * version: 1.0 <br>
 */
public class ThreadPoolTest {

    public static void main(String[] args) {
        /*ExecutorService executorService = Executors.newSingleThreadExecutor();
        executorService.submit(()->{
            System.out.println(Thread.currentThread().getName());
        });
        executorService.shutdown();*/

        ExecutorService executorService1 = Executors.newFixedThreadPool(5);
        for (int i = 0; i < 12; i++) {
            executorService1.execute(new ImRunnable());
        }
        System.out.println("主线程名称："+Thread.currentThread().getName());
        // 关闭线程池
        executorService1.shutdown();
    }
}
